package com.ceshiren.mini.converter;


import com.ceshiren.mini.dto.PlanDTO;
import com.ceshiren.mini.dto.PlanTestCasesDTO;
import com.ceshiren.mini.dto.RecordDTO;
import com.ceshiren.mini.dto.TestCaseDTO;
import com.ceshiren.mini.entity.Plan;
import com.ceshiren.mini.entity.Record;
import com.ceshiren.mini.entity.Testcase;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.springframework.stereotype.Repository;

import java.util.List;

//生成的映射器是一个单例范围的 Spring bean，可以通过以下方式检索@Autowired
@Repository
@Mapper(componentModel = "spring")
public interface RecordConverter {



    @Mappings({
            @Mapping(target = "id",source = "id"),
            @Mapping(target = "plan_id",source = "planId"),
            @Mapping(target = "report",source = "reportUrl"),
            @Mapping(target = "create_time",source = "createTime")

    })
    RecordDTO recordForRecordDTO(Record record);

    @Mappings({
            @Mapping(target = "id",source = "id"),
            @Mapping(target = "planId",source = "plan_id"),
            @Mapping(target = "reportUrl",source = "report"),
            @Mapping(target = "createTime",source = "create_time")

    })
    Record recordDTOForRecord(RecordDTO recordDTO);

    @Mappings({
            @Mapping(target = "id",source = "id"),
            @Mapping(target = "plan_id",source = "planId"),
            @Mapping(target = "report",source = "reportUrl"),
            @Mapping(target = "create_time",source = "createTime")

    })
    List<RecordDTO> recordListForRecordDTOList(List<Record> recordList);



}
